perm filename USEMUS.MAN[MAN,LCS]3 blob sn#220880 filedate 1976-06-19 generic text, type T, neo UTF8
00100	**********  Using the Music System -- MUS10  **********
00200	
00300	******* WORK IN PROGRESS -- JUNE 76 -- LELAND SMITH *********
00400	
00500	This manual is designed for use with the PDP10 at the Stanford AI lab.
00600	It  is  quite  possible  that  several features discussed will not be
00700	operative on other installations.  See appendix for some details.
00800	
00900	While all the following will refer to MUS10, the program MUSIC should
01000	do virtually the same things.  However the various messages typed out
01100	by MUSIC will often be different from those of MUS10.
01200	
01300	
01400	MUS10 is a complete sound generating  package  which  exists  on  the
01500	disk.  For first attempts type:
01600	
01700		R MUS10 	
01800		(All lines must be terminated with the 'RETURN' key.)
01900	
02000	At this point the program will type the message:
02100	
02200		INPUT?
02300	
02400	Basically  there  are  two responses possible.   If the program is to
02500	receive  further  instructions  from  another  file  which  has  been
02600	prepared with an editing program, type:
02700	
02800		NAME -- where NAME is the name of the file to be read.
02900				(If NAME has an extension, it must be used!)
03000	
03100	If instructions are to be entered by means of the  teletype  keyboard
03200	(TTY mode), type carriage return (<CR>).
03300	
03400	At  this  point  a  star  (*)  will appear which means the program is
03500	awaiting input.
03600	
03700	(It is possible that an error message  such  as  "Ill  mem.  rel"  or
03800	"Halt"  will  sometimes appear.  If this happens first type 'S' -- to
03900	restart the program -- and then type  in  exactly  whatever  you  had
04000	typed before.  If the error message recurs, find an "expert.")
04100	
04200	
04300	Most complete statements  to  be  read  by  MUS10  must  end  with  a
04400	semicolon.  Several  complete  statements  may be entered on a single
04500	line but it is best not to have the lines too long.   More  than  one
04600	line  may  be used for a single statement.  If the less-than sign (<)
04700	appears everything following on that line will be ignored.  Use  this
04800	for entering comments.
04900	
05000	   	*****  Note  that  the above rules DO NOT apply to the syntax
05100		of the SCORE program.
05200	
05300	Already  present  in MUS10 is an "instrument" known as SIMP which has
05400	been set to play a test tone of 'A' (440 hz) for 1/2 second.
05500	
05600	In  order  to  play  this  tone, first get into TTY mode as described
05700	above, then type:
05800	
05900		PLAY;SIMP;FINISH;
06000	
06100	When the computation begins "TEST.SND" will be typed out.  This  means
06200	that  sound  data  is  being  written  on  the  disk  under  the name
06300	"TEST.SND."   When the computation is finished the program  will type
06400	"TEST AMPL.=2000."  Immediately after this the following message will
06500	appear: SPEED?, <CR>, OR "X".  This means  you  have  three  options.
06600	<CR>  means  to  hit  the "RETURN" key.  This will cause the computed
06700	sound to play (unless someone else's program  has  momentary  control
06800	over  the  devices  you need.) Each time you hit the "RETURN" key the
06900	sound will play again.
07000	
07100	The sound will be playing at SPEED 1.   The SPEEDs  available  are  0
07200	through  5.   0 plays 1/2 as fast as 1, hence an octave lower; 2 play
07300	twice as fast; 3 plays four times as fast;  4  play  eight  times  as
07400	fast;  5 plays sixteen times as fast.  If a SPEED number is typed (DO
07500	NOT hit "RETURN" here) then "GO?" will be appear. At this point  type
07600	any  other character (other than <CR> or X) to hear the sound. If you
07700	type "X" the program will exit from the "play" mode  and  return  the
07800	symbol "*", which means it is waiting for some new command.  When "X"
07900	is typed, you will get the message  "PLEASE DELETE TEST.SND."    This
08000	means  that  when you have finished your work you should type <CALL>,
08100	then "DEL TEST.SND <CR>  so  the space on the disk taken  up  by  your
08200	sound tests may be reclaimed.
08300	
08400	If  you have typed an "X" but wish to return to "play" mode, type $P;
08500	where '$' indicates the 'ALT' key.
08600	
08700	
08800	******************************************************
08900	
09000	The instrument SIMP has five parameters.
09100	
09200		P1 = begin time of note (in seconds)
09300		P2 = duration of note     "     "
09400		P3 = pitch
09500		P4 = amplitude
09600		P5 = wave form (or timbre)
09700	
09800	P1 and P2 will have the same significance in all instruments but  all
09900	higher   numbered   parameters   are  assigned   roles  according  to
10000	convenience.  (However it will prove useful to consistently apply  P3
10100	and P4 as above.)
10200	
10300	Internally all pitch entries become  numerical,  however  the  twelve
10400	frequencies  of  the  tempered chromatic scale, from middle C (261.62
10500	hz) up to B may be used in MUS10 by typing the letter  names  of  the
10600	notes. The letter S = #, F = flat.
10700	
10800	Since  these  letters  merely represent the frequencies of each note,
10900	the octave range  may  be  changed  by  multiplying  or  dividing  by
11000	multiples of two.   Thus C or A in the octave below middle C would be
11100	entered as C/2 or A/2.   In the octave above the basic middle  octave
11200	these notes would be C*2 or A*2.
11300	
11400		C -- 2 octaves down would be C/4
11500		C -- 3 octaves down would be C/8
11600		C -- 2 octaves up would be C*4
11700		C -- 3 octaves up would be C*8 etc.
11800	
11900	To test the use of these letters try:
12000	
12100		P3←C;PLAY;SIMP;FINISH;
12200	
12300	Now instrument SIMP will compute middle C instead of  A.    The  left
12400	arrow  (←)  indicates  that  the  value  of  C has been placed in P3,
12500	replacing any value that was previously there.  (The left  arrow  and
12600	the equals sign[=] are interchangeable in this program.)
12700	
12800	PLAY;SIMP;FINISH;  must  be typed so the new note will be computed.
12900	After it is first heard it may be repeated as indicated above.
13000	
13100	If frequencies other than those of  the  tempered  scale  are  to  be
13200	played, a number may be used instead of a letter.
13300	
13400		P3←1000;PLAY;SIMP;FINISH; will play a tone at 1000 hz.
13500	
13600	
13700	The amplitude scale available is the range of number from 0 to  2047.
13800	(This  upper  limit  is  set  by the number of bits [12] used for the
13900	sound samples.  See appendix.) P4 has been set at 2000 for  the  test
14000	tone.  This may be reset using the same method as described before.
14100	
14200		P4←100;P3←GS*2;PLAY;SIMP;FINISH;
14300	
14400	This will play a G# above the middle octave at amplitude 100.
14500	
14600	The duration of the tone may be changed be resetting P2.
14700	
14800		P2←.1; etc. will play a note of 1/10 sec. duration.
14900	
15000	In general, test tones should rarely exceed 1" duration.
15100	
15200	When several parameters are to  be  changed  at  once  the  following
15300	type-in format should be used:
15400	
15500		PLAY;SIMP 0 .2 FS/2 850;FINISH;
15600	
15700	This will play F# below middle C for 2/10" at an  amplitude  of  850.
15800	(Please  note  that  P5,  the  wave form for SIMP, will be dealt with
15900	later.)
16000	
16100	**********  COMMAS  **********
16200	
16300	Commas may be used to separate the parameters and if nothing precedes
16400	a  comma  the contents of that parameter remains unchanged.  Also any
16500	parameter numbers higher than the length of  the  list  will  not  be
16600	affected.
16700	
16800		PLAY;SIMP ,.3,,1200;FINISH;  changes only P2 and P4.
16900	
17000	******************************************************
17100	
17200	A string of notes may be played with the following input:
17300	
17400		PLAY;SIMP 0 .2 C 1500;SIMP .2,,D;SIMP .4,,E;
17500		 SIMP .6,,C;FINISH;
17600	
17700	In this case P1 must be updated for  each  note.  (Never  overlap  an
17800	instrument  with  itself.   Distortion  will  occur.)  P2,  the  note
17900	duration remains unchanged, so the commas suffice for the last  three
18000	notes.  P4, coming at the end of the list for  the  first  note  need
18100	only be stated once if it is not to change.
18200	
18300	Rests  are created by simply leaving some time between the end of one
18400	note (P1+P2) and the beginning of the next (the new P1).
18500	
18600		PLAY;SIMP 0 .2 C;SIMP .5;FINISH; will play C  for  2/10",
18700	rest for 3/10" and then play another C for 2/10".
18800	
18900	
19000	**********  FUNCTIONS  **********
19100	
19200	The  wave  form  in P5 is entered by means of a name which is used by
19300	the program to locate a  list,  or  array,  of  numbers  (512)  which
19400	describe  the wave.  The names used for this purpose will always be F
19500	followed  directly  by  a  number.    These  arrays  will  be  called
19600	"functions."
19700	
19800	Only  one  function  is  in  MUS10,  although more can be added.  The
19900	function present is known as F1 and describes a sine  wave.   To  see
20000	this wave on the CRT type:
20100	
20200		SEE(F1);
20300	
20400	To clear the screen hit the 'ESC' key followed by  a  'C'.  (This  is
20500	called ESCAPE C.)   <CR> will bring back the typescript display if it
20600	is gone.
20700	
20800	Functions may be created with an  external  program  called  FUNC  or
20900	within  MUS10  itself  by means of two routines called SYNTH and SEG.
21000	SYNTH is used to create composites made by adding  various  harmonics
21100	together.  The form of F1 could be changed in the following manner:
21200	
21300		SYNTH(F1); 1,1  2,1  3,.5  999;
21400	
21500	In the three pairs of numbers, the first of each pair represents  the
21600	harmonic  number  and  the  second  the  relative  amplitude  of that
21700	harmonic.   Thus the ratios of harmonics 1, 2 and 3 will be 1:1:.5 .
21800	
21900	The size of the second number of each pair is important only  in  its
22000	relation to the other amplitude numbers.  The last  number,  999,  is
22100	used to signal the termination of a string of entries.
22200	
22300	Several pairs may entered and harmonic numbers up to 256 may be  used
22400	but  in  practice  great  care  must be taken to avoid the "foldover"
22500	effect which  occurs  when  frequencies  higher  than  one  half  the
22600	sampling rate are present. (See appendix.)
22700	
22800	It should be pointed out that the fundamental (harmonic #1) need  not
22900	be present in a wave.
23000	
23100		SYNTH(F1); 10,1  12,1  15,1  999; will give  the  three notes
23200	of a minor chord.  After this has been  entered  the  following  will
23300	cause a C minor chord to play:
23400	
23500		PLAY;SIMP 0 .5 GS/8;FINISH;
23600	
23700	While the lowest Ab (or G#) on the piano keyboard has been indicated,
23800	since  the wave form includes only the 10th, 12th and 16th harmonics,
23900	the notes middle C, Eb and G will be heard.
24000	
24100	Several  experiments  with  different  wave forms should be made.  Be
24200	sure to SEE the waves so a visual-aural connection might be made.
24300	
24400	A function may be changed in the middle of a PLAY routine but it must
24500	be  noted that the new wave definition must follow! the note which it
24600	is to affect.
24700	
24800		In PLAY;SIMP 0 .3 D 1000; SIMP .3; SYNTH(F1); 1,.7  3,.2
24900		    5,.1  999; SIMP .6,,E; FINISH;  the newly defined wave
25000	     	will be heard in the second and third notes.
25100	
25200	
25300	If you wish to have several functions with different names  available
25400	and you do not create them with the FUNC program, their names must be
25500	"declared" to MUS10.  Suppose you wish to have F2, F3  and  F4.   You
25600	must type directly to MUS10 (or into an  EDIT file which will be read
25700	by MUS10) the following:
25800	
25900	   ARRAY F2,F3,F4(512);
26000	
26100	The "(512)" indicates that each function array will require 512 words
26200	of storage. 
26300	
26400	The following example will play a sequence of notes wherein are heard
26500	the 10th, 14th and 18th harmonics of a low C, then the 10th, 13th and
26600	16th, and finally the 10th, 12th and 14th harmonics.
26700		As  each  SYNTH  function  is  typed  in  the  wave  will  be
26800	displayed (at some terminals.) If you wish a clear screen  after  the
26900	last  one has appeared, hit the 'ESC' key followed by a 'C'. (This is
27000	called ESCAPE C.)
27100	
27200		ARRAY F2,F3(512);
27300		SYNTH(F1);10,1 14,1 18,1 999;
27400		SYNTH(F2);10,1 13,1 16,1 999;
27500		SYNTH(F3);10,1 12,1 14,1 999;
27600		PLAY;SIMP 0 .3 C/4 2000 F1;
27700		SIMP .3,,,,F2;SIMP .6,,,,F3;FINISH;
27800	
27900	
28000	
28100		From this point on it would probably be better to prepare any
28200	input  for MUS10 which requires more than a couple of lines of typing
28300	with the SOS or ETV editors.  Typographical errors are inevitable and
28400	when an error is made near the beginning of a string of  input  typed
28500	directly to MUS10 you most likely will have to retype everything.
     

00100	A type of flow-chart diagram for SIMP would appear as follows:
00200	
00300			 P4       MAG*P3
00400			  |         |
00500			  ↓         ↓
00600			***************
00700			*             *    OSCIL
00800			*             *    U1 (UNIT GENERATOR ONE)
00900		        *     P5      *
01000		         *           *
01100			  *         *
01200			   *********
01300			       |
01400			       ↓
01500			     *****
01600			    * OUT *
01700			    *  A  *
01800			     *****
01900	
02000	The top left input, P4, serves simply as a multiplier for the numbers
02100	found  in  the  wave  form array, P5.  The particular number from the
02200	array to be multiplied is determined by the number in the upper right
02300	input.   The  upper  right  input, in this case P3, when processed by
02400	"MAG" (the "magic" number) becomes the increment, the rate  at  which
02500	the  wave form array is stepped through.  The "magic" number is found
02600	by dividing the array length, 512, by the sampling rate,  12800  (for
02700	SPEED 1.)
02800	
02900	   512/SRATE=.04 (Higher sampling rates will be discussed later.)
03000	
03100	The  maximum  size of the numbers in the wave array is + or -1.  Thus
03200	if P4 is set to 1000 the output of the OSCIL will be numbers  in  the
03300	range  +1000  to  -1000 which will describe the wave form put into P5
03400	cycling at the rate given in P3.
03500	
03600	
03700	The code for entering this instrument follows:
03800	
03900		INSTRUMENT SIMP;
04000		OSCIL(P4,MAG*P3,P5);
04100		OUTA←OUTA+U1;
04200		END;
04300	
04400	This  instrument  has  only  one unit generator (the OSCIL) hence the
04500	output of U1 is added to the contents of OUTA.  If there are  several
04600	instruments  the  outputs  of all the instruments will be combined in
04700	OUTA for each sample.
04800	
04900	It will be noticed when playing instrument SIMP that the sound begins
05000	and ends quite abruptly.  This is because  no  attack-decay  envelope
05100	has been applied to the tone.  The sound begins at the full amplitude
05200	of P4 and remains at that level for  its  total  duration.
     

00100	
00200	To apply an envelope, another unit generator must be added.
00300	
00400	
00500			 P4       MAG/P2
00600			  |         |
00700			  ↓         ↓
00800			***************
00900			*             *    OSCIL
01000			*             *    U1 (UNIT GENERATOR ONE)
01100		        *     P5      *
01200		         *           *
01300			  *         *
01400			   *********
01500			       |
01600			       | 	 MAG*P3
01700			       |         |
01800			       ↓         ↓
01900			     ***************
02000			     *             *    OSCIL
02100			     *             *    U2 (UNIT GENERATOR TWO)
02200		             *     P6      *
02300		              *           *
02400			       *         *
02500			        *********  		INSTRUMENT TOOT;
02600			            |			OSCIL(P4,MAG/P2,P5);
02700			            ↓			OSCIL(U1,MAG*P3,P6);
02800			          *****			OUTA←OUTA+U2;
02900			         * OUT *		END;
03000			         *  A  *
03100			          *****
03200	
03300	Now that the instrument has been expanded you will note  that  it  is
03400	the output of unit generator two (U2) which goes to OUTA.
03500	
03600	P5 will now contain the envelope array.   This array is best  defined
03700	by the SEG routine.   SEG defines the positions of line segments used
03800	to approximate a curve.   With SEG several pairs of  numbers  may  be
03900	entered.   The first number of each pair is an amplitude, normally in
04000	the  range of 0 to 1, and the second is the step number in the array.
04100	The step numbers 1 through 100 are used in SEG.   (However  the  step
04200	numbers are  converted  internally to 512 array locations.)  Straight
04300	line segments are drawn between each of the  points  defined.     The
04400	following would put a triangular envelope shape into F1:
04500	
04600		ARRAY F1(512);
04700		SEG(F1); 0,1  1,50  0,100;
04800	
04900	    Note that the routine is terminated when step 100 is reached.
05000	    DO NOT USE 999 with SEG.
05100	
05200	After having typed in the code for instrument TOOT and the definition
05300	for an  envelope in F1,  the following will produce a note using that
05400	envelope:
05500	
05600		SYNTH(F3);1,1  2,.4   3,.1 999;< Sets the tone color.
05700		PLAY;TOOT 0 .5 A 2000 F1 F3;FINISH;
05800	
05900	If two envelopes are to be contrasted add another function and define
06000	it.
06100		ARRAY F2(512);
06200		SEG(F2); 0,1  1,7  .2,25  .1,60  0,100;< Staccato
06300		PLAY;TOOT 0 .2 1000 2000 F2 F1;  < P5 has envelope
06400		TOOT .2 .5,,,F1;FINISH;<Plays stac. then sust.(F1 then F2)
06500	
     

00100	In the next example a unit generator will be added  above  the  right
00200	side  of  the  bottom,  tone producing unit generator.  In this way a
00300	function may be used to describe fluctuations  of  pitch  within  the
00400	duration  of  a  note  --  much  as  the  previous  example  gave the
00500	possibility for changing the amplitude during a single note.
00600	
00700	
00800					 MAG*P7-MAG*P3       MAG/P8
00900		 P4       MAG/P2		   |         |
01000		  |         |			   ↓         ↓
01100		  ↓         ↓			 *************** 
01200		***************			 *	       *   OSCIL
01300		*	      *	 OSCIL		 * 	       *   U2
01400		*             *  U1     	 *     P9      *
01500		*     P5      *      		  *           * 
01600	         *           * 			   *	     * 
01700	          *         * 			    *********
01800		   ********* 	   MAG*P3		|
01900		       |	       |   _____________|
02000		       |________      _↓___↓_
02100			       |      \     /
02200			       |       \ + /
02300			       |        \_/
02400			       |         |
02500			       ↓         ↓
02600			     ***************
02700			     *		   *
02800		     OSCIL   *             *
02900		     U3	     *     P6      *
03000		              *           * 
03100			       *         *
03200			        *********     INSTRUMENT GLISS;
03300			            |	      OSCIL(P4,MAG/P2,P5);
03400			            ↓	      OSCIL(MAG*P7-MAG*P3,MAG/P8,P9);
03500			          *****	      OSCIL(U1,MAG*P3+U2,P6);
03600			         * OUT *      OUTA←OUTA+U3; END;
03700			         *  A  *
03800			          *****
03900	
04000	
04100	In order for this instrument to perform glissandos, a third  function
04200	must  be  defined  for P9 (the "shape" of the glissando).  A straight
04300	line slope will suffice for a simple glissando.  After typing in  the
04400	instrument definition set up the three functions.
04500	
04600		ARRAY F5,F6(512); <F1 is already present.
04700		SEG(F5);0,1  .8,7  1,12  1,90  0,100;<Envelope
04800		SEG(F6);0,1  1,100; <Slope
04900	
05000	In the preceding, the ARRAY declaration is needed only when some  new
05100	function names are to be used.
05200	
05300	The following will play a glissando up two octaves, from C to C*4.
05400	
05500		PLAY; GLISS 0 1 C 2000 F5  F1 C*4 1 F6; FINISH;
05600	
05700	If P8←.5; (while P2 remains at 1) two glissandos will be heard.
05800	
05900	
06000	
06100	This  instrument  may  be  used  for  a  dramatic  demonstration   of
06200	"foldover", the phenomenon  which occurs when a frequency exceeds the
06300	upper limit of one half the sampling rate.  (See Mathews' book for  a
06400	technical explanation.)
06500	
06600	For this purpose it is best to use a Sine wave in P6.
06700	
06800		SYNTH(F1); 1 1  999;
06900	
07000		PLAY; GLISS 0 1 1000 2000 F5 F1 4000 1 F6;FINISH;
07100	
07200	This first note will slide up from 1000 hz to 4000 hz.
07300	
07400	
07500		PLAY; GLISS 0 1 1000 2000 F5 F1 11800 1 F6;FINISH;
07600	
07700	Due to "foldover" (at 12800/2 hz.) this note will slide up to 6400 hz
07800	and return to the 1000 hz level even though 11800 hz was given in P7.
07900	The  general rule for "foldover" is that any frequencies which exceed
08000	one half the sampling rate will be heard at (SRATE-F) hz.
08100	
08200	
08300	Try this one!
08400	
08500		PLAY; GLISS 0 1 0 2000 F5 F1 30000 1 F6; FINISH;
08600	
08700	
08800	This same instrument may be used to produce a vibrato  by  putting  a
08900	sine  wave into P9, setting P8←1/7; (the vibrato rate will be 7 times
09000	per second) and making P7 some very small amount different from P3.
09100	
09200		PLAY; GLISS 0 1 C 2000 F5  F1 C+2 1/7 F1; FINISH;
09300	
09400			(It is assumed that F1 is a sine wave.)
     

00100		Various types of noise  and  other  random  fluctuations  are
00200	produced  by the two random number unit generators.  These are called
00300	RANDH and RANDI.  RANDH (H=hold) produces in effect a  function  made
00400	up  of  horizantal  lines at various levels with a perpendicular jump
00500	from one level to the next.  There are  two  inputs  to  RANDH.   The
00600	first   (left  hand)  gives  the  range,  plus  or  minus,  of random
00700	selection and the second (right hand) gives the rate (per  second) at
00800	which the selections are to be made.
00900	
01000		Care  must  be  taken with the number in the first input.  If
01100	the number 100 is given, the output of RANDH will  fluctuate  between
01200	+100  and  -100.  Thus if a range of 100 to 200 is desired, the input
01300	number should be 50 and the number 150 must be added to the output.
01400	
01500	
01600					        MAG*P7     MAG*P8
01700		 P4       MAG/P2	           |         | 
01800		  |         |		           ↓         ↓
01900		  ↓         ↓			 *************** 
02000		***************			 *	       *   
02100		*	      *	 OSCIL		 *    RANDH    *   U2
02200		*             *  U1     	 ***************
02300		*     P5      *      		        |
02400	         *           * 			        |
02500	          *         * 			        | 
02600		   ********* 	   MAG*P3		|
02700		       |	       |   _____________|
02800		       |________      _↓___↓_
02900			       |      \     /
03000			       |       \ + /
03100			       |        \_/
03200			       |         |
03300			       ↓         ↓
03400			     ***************
03500			     *		   *
03600		     OSCIL   *             *
03700		     U3	     *     P6      *
03800		              *           * 
03900			       *         *     
04000			        *********     INSTRUMENT NOISE;
04100			            |	      OSCIL(P4,MAG/P2,P5);
04200			            ↓	      RANDH(MAG*P7,MAG*P8);
04300			          *****	      OSCIL(U1,MAG*P3+U2,P6);
04400			         * OUT *      OUTA←OUTA+U3; END;
04500			         *  A  *
04600			          *****
04700	
04800				ARRAY F2(512); <F1 is already present.
04900				SEG(F2);0,1  .8,7  1,12  1,90  0,100;<Env.
05000	
05100	
05200	
05300	
05400		The following will produce white noise.
05500	
05600		SRATE←25600;MAG←512/SRATE;
05700		PLAY;NOISE 0 .5 C*8 1000 F2 F1 P3 P3*4;FINISH;
05800	
05900		Actually  P8 (given as P3*4) can probably be left at a number
06000	like 4000 for  noise  purposes.    As  P7  is  changed  the  apparent
06100	band-width  of  the  noise  will  be changed.  As the band-width gets
06200	narrower the center frequency becomes more apparent. Thus if P7←P3/16
06300	and  P3 is up in the range of C*8, something of the effect of blowing
06400	across an open tube will be produced.  The  pitch  is  clear  --  but
06500	quite windy.
06600	
06700		The  SRATE  (sampling  rate)  must  be  increased  for  noise
06800	production since very high frequencies are essential.  At SRATE←25000
06900	the high frequency cut-off will be at 12800 hz.
07000	
07100		If P8 is set to a  low  number  (e.g.  8)  individual  random
07200	pitches, instead of noise, will be produced at that rate.
07300	
07400	
07500		If the random unit generator  is  replaced  by  a  RANDI  the
07600	random  function  produced  will  be  made  up  of a series of slopes
07700	(I=interpolating) up and down from one random point to  another.   In
07800	the case of noise production there is little difference between RANDI
07900	and RANDH.  However RANDI is necessary for  getting  such  things  as
08000	random  vibrato.    The following will produce an acceptable, "human"
08100	sounding vibrato.
08200	
08300		PLAY; NOISE 0 1 C*2 1000 F2  F1 P3*.01 16; FINISH;
08400	
08500		The random rate of 16 per  second  (in  P8)  is  considerably
08600	faster  than  the  human  vibrato rate of 5 to 8 per second.  In this
08700	case however since  the  full  band-width  (in  P7)  is  only  seldom
08800	attained and the heard effect is that of a rate much slower than 16.
     

00100	
00200	
00300	
00400	With an ordinary OSCIL there is no simple way to  have  a  long  note
00500	keep  the  same  characteristics of attack and decay as a short note.
00600	The LINEN unit generator is used to create  envelopes  with  separate
00700	controls over attack time, decay time and steady state.
00800	
00900	
01000		  	  P7   P8   P9
01100		 	  |    |    |
01200		P4	  ↓    ↓    ↓        VAR
01300		| 	***************       | 
01400		|      *               *      |     LINEN	
01500		|     *                 *     |   U1 (UNIT GENERATOR ONE)
01600		---→ *        P5         * ←---
01700		    *                     * 
01800		   *                       *  
01900		  ***************************
02000			       |
02100			       | 	 MAG*P3
02200			       |         |
02300			       ↓         ↓
02400			     ***************
02500			     *             *    COSCIL
02600			     *             *    U2 (UNIT GENERATOR TWO)
02700		             *     P6      *
02800		              *           *       VARIABLE /VAR;
02900			       *         *	  
03000			        *********  	  INSTRUMENT LIN;
03100			            |		  LINEN(P4,P7,P8,P9,P5,VAR);
03200			            ↓		  COSCIL(U1,MAG*P3,P6);
03300			          *****		  OUTA←OUTA+U2;
03400			         * OUT *	  END;
03500			         *  A  * 	  
03600			          *****
03700	
03800	
03900	
04000	The parameter arrangement for LINEN is rather different from that for
04100	OSCIL.  The far left parameter (P4) is, as usual, an amplitude input.
04200	The next three (P7, P8  and  P9  in  this  particular  example)  will
04300	receive  the  attack  duration,  the  decay  duration  and  the total
04400	duration of the envelope, in  that  order.   The  next  item  in  the
04500	parameter  list  (P5 here) will contain the envelope array name.  The
04600	last item is a "run-time" variable which is  needed  to  ensure  that
04700	each note uses the correct portion of the overall envelope.
04800	
04900	The internal workings of LINEN make it unnecessary to use "MAG"  with
05000	the  3  time  domain  parameters.   The  proper conversion of time to
05100	increments is automatic.  The 3rd parameter (P9) of this group  could
05200	have  been  P2.  However since P2 is always a special parameter which
05300	tells how long the instrument is to be turned, its  use  to  indicate
05400	the  total  duration of the envelope would make it impossible to play
05500	several notes within one envelope cycle (a phrase.)
05600	
05700	The array used for LINEN must be defined in a special way.  Only  the
05800	first 2/3 of the available locations are to be used.  When using SEG,
05900	steps 1-25 are reserved for the attack portion, steps 26-50  for  the
06000	"steady  state"  and steps 51-75 for the decay portion.  Steps 76-100
06100	are ignored by LINEN but must be included in the SEG input  in  order
06200	for  the SEG routine to conclude properly.  To test the properties of
06300	LINEN it is best to construct an envelope with dramatic changes.
06400	
06500		ARRAY F2(512);
06600		SEG(F2); 0,1  1,2  .3,25  1,50  0,75  0,100;
06700	
06800	If parameters 7, 8 and 9 are set properly, this  array  will  give  a
06900	sharp  attack  followed  by  a  return to a low amplitude (.3) at the
07000	start of the "steady state"  section.   Following  there  will  be  a
07100	relatively  slow  crescendo to full amplitude and then a rapid decay.
07200	It must be emphasized that the sum of the values given for P7 and  P8
07300	(attack  and  decay)  must  never  exceed  the  value  of  P9  (total
07400	duration.) Likewise, P9 should never be less than P2, (the total time
07500	the instrument is turned on for a single note.) To visualize the true
07600	shape of the envelope for any particular note duration (ND)  consider
07700	that  the  time  spent in the middle section of the array (SS="steady
07800	state" area) will be what is left when the attack (AT) and decay (DK)
07900	are subtracted from the total duration (TD.)
08000	
08100		SS = TD - AT - DK
08200	
08300	To play the following notes add about 5k to your core image.
08400	
08500		PLAY; LIN 0 1 A 2000 F2 F1 .08 .08 1; VAR=0; FINISH;
08600	
08700	
08800	The special  variable  VAR  is  used  to  reset  a  pointer  for  the
08900	initialization  of  the envelope.  When a variable is declared with a
09000	preceding slash ( /VAR ) it is known as a "run-time" variable.   This
09100	means   that,  unlike  ordinary  parameters  which  are  read  by  an
09200	instrument only at the  beginning  of  a  note  (at  input  time,  or
09300	"I-time"),  a  "run-time"  variable  is  read or changed every time a
09400	sample is computed.  A unique variable must be used  for  each  LINEN
09500	unit  generator.    The  variable must be set to 0 immediately after!
09600	each detached note or after the first note of a phrase.
09700	
09800	In  the  following,  the 2 notes D, F will be connected (phrased) and
09900	the 3rd note, C#, will be detached.   Notice  that  the  first  value
10000	given  in  P9  (total  duration  of  envelope)  represents  the total
10100	duration of the first 2 notes.  P9 is changed to  equal  P2  for  the
10200	separate note.
10300	
10400		PLAY; LIN 0 .5 D 2000 F2 F1 .08 .08 1; VAR=0;
10500		LIN .5 .5 F;    < P4 to P9 remain the same.
10600		LIN  1 .5 CS 2000 F2 F1 .08 .08 .5; VAR=0;
10700		FINISH;
10800	
10900	
11000	
11100	You will have noticed that the last unit generator in this instrument
11200	is called a COSCIL.  This is exactly like an OSCIL  except  that  the
11300	pointer  to  the array is never re-initialized.  This allows the wave
11400	form produced to be continuous from one note to the next.   (The  "C"
11500	indicates it is a "continuing" OSCIL).  If an OSCIL were used in this
11600	situation clicks would often be heard between phrased notes.
     

00100	
00200		Frequency modulation allows for  the  production  of  a  wide
00300	variety  of  tone  colors  using relatively little compute time.  The
00400	INTRP unit generator is really just a  combination of an OSCIL and an
00500	ADD box.  The left input represents the output when the function (P10
00600	below) is at zero and the right input represents the output when  the
00700	function  is  at  1  (peak  amplitude).   No time input is given with
00800	INTRP.  The speed of stepping through the function  array  is  always
00900	taken  as  being  P2,  i.e. the note duration.  In this case P10 will
01000	contain an envelope which  will  control  the  changes  in  frequency
01100	modulation.   For  a  full  explanation of FM see John Chowning's AES
01200	Journal article on this subject.
01300	
01400	
01500					 P9*P7*MAG    P8*P9*MAG
01600					      |         |
01700					      ↓         ↓
01800					    ***************
01900					     *           *
02000					      *   P10   *   INTRP
02100					       *       *    U2
02200						*     *
02300						 *   *
02400						  * *
02500					           *         P9*MAG
02600		 P4       MAG/P2		   |         |
02700		  |         |			   ↓         ↓
02800		  ↓         ↓			 *************** 
02900		***************			 *	       *   OSCIL
03000		*	      *	 OSCIL		 * 	       *   U3
03100		*             *  U1     	 *     P11     *
03200		*     P5      *      		  *           * 
03300	         *           * 			   *	     * 
03400	          *         * 			    *********
03500		   ********* 	   MAG*P3		|
03600		       |	       |   _____________|
03700		       |________      _↓___↓_
03800			       |      \     /
03900			       |       \ + /
04000			       |        \_/
04100			       |         |
04200			       ↓         ↓
04300			     ***************
04400			     *		   *
04500		     OSCIL   *             *
04600		     U4	     *     P6      *
04700		              *           * 
04800			       *         *     
04900			        *********     INSTRUMENT FM;
05000			            |	      OSCIL(P4,MAG/P2,P5);
05100			            ↓	      INTRP(P7*P9*MAG,P8*P9*MAG,P10);
05200			          *****	      OSCIL(U2,P9*MAG,P11);
05300			         * OUT *      OSCIL(U1,U3+P3*MAG,P6);    
05400			         *  A  *      OUTA←OUTA+U4; END; 
05500			          *****
05600	
05700	
05800	
05900	    The following functions should be set up to test the FM instrument.
06000	
06100		ARRAY F1,F2,F3(512);
06200		SYNTH(F1); 1 1 999;   < A sine wave.
06300		SEG(F2);0,1  .9,4  1,8  1,72  .8,88  .5,95  0,100; < Envelope
06400		SEG(F3); 0,1  1,100;  < An upward slope or ramp.
06500	
06600		The following will produce a shift from a pure sine tone to a
06700	highly modulated tone over a period of 2 seconds.
06800	
06900		PLAY; FM 0 2 100 1000 F2   F1 0 10 100 F3  F1; FINISH;
07000	
07100	
07200		To reverse the procedure, i.e. change from the modulated tone
07300	to the pure tone, reverse the values of P7 and P8.
07400	
07500		P7←10; P8←0; PLAY;FM;FINISH;
07600	
07700	
07800		Change F3 (the ramp) to make the modulation  emerge  only  in
07900	the mid-part of the note.
08000	
08100		SEG(F3); 0,1  1,50  0,100;  < Makes a pyramid.
08200	
08300		PLAY;FM;FINISH;
08400	
08500		Try several of the variations suggested in Chowning's article.
     

00100	********** APPENDIX XXX NOT COMPLETE!!!XXX  ************
00200	
00300	The main program for sound generation is currently  called  MUSIC.FAI
00400	or some  similar  name.      The export version is designed to run on
00500	a standard PDP10 DEC system (which has a "FAIL" compiler.)
00600	
00700	The main program must be loaded with two  subroutine  packages  which
00800	are  called MUSF4.F4 (OR MUSEXP.F4) and MUSIO.FAI (or EXPIO.FAI.) The
00900	FORTRAN routines are for the creation  of  function  arrays  and  for
01000	organizing  the  output  of  sound samples to tape or disk after they
01100	have been computed.  The FAIL routines are for fast output of  blocks
01200	of samples.
01300	
01400	See SCORE.LCS[UP,DOC] for information on longplaying features (RCDFLG
01500	and BIGBIT) and much other information.
01600	
01700	
01800	
01900	
02000	************ LOCAL SPEAKERS ***********
02100	
02200	
02300		To hear all sounds produced by the  D-A  converter  from  the
02400	small  speaker  associated  with  your  TTY console hit the 'ESC' key
02500	followed by the '3', and then the 'U'. (ESCAPE 3 U).
     

00100	********* SOME INFO RE. THE 'FUNC' PROGRAM ***********
00200	
00300	CRUNCH:  Any two functions already in  a  single  .DAT  file  may  be
00400	"crunched" together.  Also, a function may be created by  either  the
00500	SEG  or  SYNTH  routines and then if instead of typing "F" for FINISH
00600	the letter "Z" is typed the program will jump immediately to "crunch"
00700	mode.   At  this  point  the  new  function  may be combined with any
00800	function found in the file presently in core.  Note however that once
00900	this new function  is  processed  by  any  of  "crunch"  options  its
01000	original  form  cannot be regained without going back to ordinary SEG
01100	or SYNTH mode.
01200	
01300	PLOTTING:  If "SP" (=see on the plotter) is  typed  single  functions
01400	can  be  drawn  on  the  Calcomp  plotter.   The size asked for is in
01500	inches. "SA" (=see all on plotter) will plot all the functions  found
01600	in  a single file. "SX" (=see all on the XGP) will draw all functions
01700	from  a  single  file in the proper size for printing by the XGP.  In
01800	order to use "SX" you must!!! follow the next steps exactly!!!
01900	
02000		Before running FUNC type: A DSK PTP <CR>. This will cause the
02100		instructions FUNC sends to the plotter to  be  written  in  a
02200		file on the disk.
02300	
02400		When  the  FUNC  program  finishes  then  type  R X <CR>.
02500		This runs a  program  called  X  which  converts  plotter 
02600		information to XGP commands.
02700	
02800		X will ask you 5 questions.  You should answer as follows:
02900	
03000			PLOT.BIN <CR>		(the file name)
03100			<CR>			(plot slice?)
03200			5  <CR>			(shift 5 inches)
03300			<CR>			(use default value of 11".)
03400			1  <CR>			(1 inch from the left)
03500			Y			(yes, delete the plot file)
03600	
03700	
03800	
     

00100	Information re. WAVES.   To run it type R WAVES.
00200	
00300	This  will  allow  you  to  display  the  actual wave shapes of sound
00400	computed by MUS10. The TEST.SND file thus produced is read by WAVES.
00500	
00600	You may display up to 3072 samples at a  time  but  since  only  1024
00700	separate  positions  can be shown at once, larger  numbers will cause
00800	some samples to be skipped over (but with no great loss.) After  each
00900	group  of samples is displayed a <CR> will move on to the next group.
01000	If a number is typed, that will set the extent of the next group.  If
01100	the number -1 is given, the program will automatically cycle  through
01200	all available samples by groups of the last given number.   (When  no
01300	more samples  are to be found it will end with an error message.)  In
01400	order to make the program  go  backwards  type  any number less  than
01500	-2 for the number of samples you wish to back up.
01600	
01700	This  program  should be of use in seeing the wave shapes produced by
01800	amplitude and frequency modulation as well as seeing the  effects  of
01900	foldover,  etc.   Composite  waves  from  more  than one voice may be
02000	displayed but  as  the  complexity  increases  it  may  prove  rather
02100	difficult to glean useful information from what is seen.
02200	
02300	(When  WAVES  asks  "TYPE  FILE  NAME",  a  simple  <CR>  will be the
02400	equivalent of typing TEST.SND <CR> .)